package org.mapdroid;

import org.mapdroid.maps.gmaps.MdMapActivity;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.animation.AnimationUtils;

public class MapDroid extends Activity implements OnTouchListener{
	public static final String MAPDROID_PREFERENCES = "MAPDROID_PREFERENCES";
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        this.setContentView(R.layout.welcome_view);
        
        View mapDroidLogoView = (View) findViewById(R.id.welcome_view_image);
        mapDroidLogoView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fading_in));
        View mainView = (View) findViewById(R.id.welcome_view);
        mainView.setOnTouchListener(this);
    }
    
    @Override
    public void onPause(){
    	super.onPause();
    }
    
    @Override
    public void onResume(){
    	super.onResume();
    }

    @Override
    public void onDestroy(){
    	super.onDestroy();
    }

	@Override
	public boolean onTouch(View arg0, MotionEvent arg1) {
		// TODO Auto-generated method stub
		if(arg1.getAction()==MotionEvent.ACTION_DOWN){
			try{
				arg0.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fading_out));
				this.finish();
				Intent mapIntent = new Intent(this, MdMapActivity.class);
				this.startActivity(mapIntent);        	
	        }
	        catch(ActivityNotFoundException e){
	        	e.printStackTrace();
	        }
		}
		return false;
	}
}